﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using WoChu.RfClient.Entity;

namespace WoChu.RfClient.Duty
{
    public class OrderCheckUIRule
    {
        private static OrderCheckUIRule _NewInstance = new OrderCheckUIRule();

        public static OrderCheckUIRule NewInstance
        {
            get
            {
                if (_NewInstance == null)
                {
                    _NewInstance = new OrderCheckUIRule();
                }

                return _NewInstance;
            }
        }

        public ResultModel<List<OrderItemInfo>> Query(string OrderNo)
        {
            try
            {
                ResultModel<List<OrderItemInfo>> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<IOrderCheck>.NewInstance.InvokeWebMethod < ResultModel<List<OrderItemInfo>>>("Query", new object[] { OrderNo });
                if (_result == null)
                    return new ResultModel<List<OrderItemInfo>>().GetInstance();
                return _result;  
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
                return new ResultModel<List<OrderItemInfo>>().GetInstance();
            }
          
        }

        public ResultModel<bool> InsertPDACheckOrder(string userID, OrderInfo orderInfo)
        {
            ResultModel<bool> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<IOrderCheck>.NewInstance.InvokeWebMethod<OrderInfo, ResultModel<bool>>("InsertPDACheckOrder", new object[] { userID }, orderInfo);
            if (_result == null)
                return new ResultModel<bool>().GetInstance();
            return _result;  
           
        }

        public ResultModel<bool> UpdatePDACheckOrder(string userID, OrderInfo orderInfo)
        {
            ResultModel<bool> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<IOrderCheck>.NewInstance.InvokeWebMethod<OrderInfo, ResultModel<bool>>("UpdatePDACheckOrder", new object[] { userID }, orderInfo);
            if (_result == null)
                return new ResultModel<bool>().GetInstance();
            return _result; 
        }

        public ResultModel<bool> SetCheckOrderItem(string userID, List<OrderItemInfo> lstOrderItem)
        {
            ResultModel<bool> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<IOrderCheck>.NewInstance.InvokeWebMethod<List<OrderItemInfo>, ResultModel<bool>>("SetCheckOrderItem", new object[] { userID }, lstOrderItem);
            if (_result == null)
                return new ResultModel<bool>().GetInstance();
            return _result; 
        }
      
    }
}
